
<% if @user && @user == @current_catalog.owner -%>
<%= link_to 'Edit', :action => 'edit', :id => @picture %> |
<%= link_to 'Delete', { :action => 'destroy', :id => @picture},
    :confirm => 'Are you sure you want to delete this picture', :method => :post %> |
<% end -%>

<%= link_to 'Back', :action => 'list' %>

<hr />

<div class="sample">
     <a href = "/user/picture/get_picture/<%= @picture.id %>?view=0" >
        <img src="/user/picture/get_picture/<%= @picture.id %>?view=1" width="320" height="240" alt="Loading..." /><br />
     </a>    
</div>

<p> <b>Name: </b> <%= h(@picture.name) %> </p>
<p> <b>Description: </b> <%= h(@picture.description) %> </p>
<p> <b>Created at: </b> <%= h(@picture.created_at) %> </p>
<p> <b>Owner: </b> <%= h(@picture.catalog.owner.username) %> </p>
<p> <b>Access: </b> <%= get_access(@picture.id) %> </p>

<div class="spacer"> &nbsp </div>

<div class="comment_container">
    <%- for comment in @comments do%>
        <div class="comment_header">
          <div class="comment_username"> <%= h(comment.user.username)%> </div>
          <div class="comment_date"> <%= h(comment.created_at) %> </div>
        </div>
        
        &nbsp
        
       <div class="comment_text">
         <%= h(comment.comment)%>        
       </div>

       <div class="spacer"> &nbsp </div>
    <%-end%>  
</div>

<%= will_paginate(@comments)%>

 <div class="spacer"> &nbsp </div>

 <% if @user -%> 
   <% form_tag( :action => 'post_comment', :id => @picture) do %>
   <fieldset style="width: 40em;" >        

      <legend>Post New Comment</legend>                

      <%= text_area("comment", "comment", :cols => 90, :rows => 5) %>
      <br />

     <input class="submit-button" type="submit" value="Post" />

  </fieldset>
  <% end %>
<% end -%>
